package com.qumitech.visualnovel.component.util;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author qingyunliao
 * @create 2018-05-28 20:47
 */
public class RandomUtils {

    /**
     * 获取概率为probability的可能性
     * @param probability
     * @return
     */
    public static int notEqualProbability(double probability) {
        int gap = (int) probability * 100;
        int randomNum = ThreadLocalRandom.current().nextInt(0, 100);
        return randomNum < gap ? 1 : 0;
    }
}
